package cn.fl.system.service.impl;

import cmm.comm.facade.framework.api.ISysDictionaryApiService;
import cn.fl.system.service.IEncrptStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author hongyanbo
 * @since 2020/2/27
 */
@Service
public class EncrptStrategyImpl implements IEncrptStrategy {
    public static final String SYS0072 = "SYS0072";
    @Autowired
    private ISysDictionaryApiService sysDictionaryApiService;
    @Override
    public boolean isNeedEncrpt(Long roleId) {
        String role = null;
        if(roleId!=null){
            role = String.valueOf(roleId);
        }
        Map<String, String> map = this.sysDictionaryApiService.searchGroupToMap("11000", "0000", SYS0072);
        if(map!=null && role!=null && map.containsKey(role)){
            String s = map.get(role);
            if("0".equals(s)){
                return false;
            }
        }
        return true;
    }
}
